package com.wx.mythread.thread;

import sun.plugin.ClassLoaderInfo;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

public class LockSynchroize {
    Lock lock = new ReentrantLock();

    public synchronized void method(){
        System.out.println("我是synchronized形式的锁");
    }

    public void method1(){
        try {
            lock.lock();
            System.out.println("我是lock锁的形式");
        }finally {
            lock.unlock();
        }
    }

    public static void main(String[] args) {
        LockSynchroize lockSynchroize = new LockSynchroize();
        lockSynchroize.method();
        lockSynchroize.method1();
    }
}
